package registnet.cpm;

/**
 * An implementation of an arc in a network diagram. An arc represents 
 * a precedence relationship between two activities in a <code>Project</code>.
 */
public class Arc {
	
	/**
	 * The name of the arc.
	 */
	private String name;
	
	/**
	 * The start node connected by the arc.
	 */
	private Node startNode;
	
	/**
	 * The end node connected by the arc.
	 */
	private Node endNode;
	
	/**
	 * Default constructor.
	 */
	public Arc(){
	}
	
	/**
	 * Creates an arc with the given name.
	 * @param name
	 */
	public Arc(String name){
		this.name = name;
	}
	
	/**
	 * Creates an arc with the given name, connecting the given start node and end node.
	 * @param name
	 * @param startNode
	 * @param endNode
	 */
	public Arc(String name, Node startNode, Node endNode){
		this.name = name;
		this.startNode = startNode;
		this.endNode = endNode;
	}
	
	/**
	 * Sets the name of the arc.
	 * @param name
	 */
	public void setName(String name){
		this.name = name;
	}
	
	/**
	 * Returns the name of an arc.
	 * @return the name of an arc
	 */
	public String getName(){
		return this.name;
	}
	
	/**
	 * Sets the start node connected to the arc.
	 * @param startNode
	 */
	public void setStartNode(Node startNode){
		this.startNode = startNode;
	}
	
	/**
	 * Returns the start node connected to the arc.
	 * @return the start node connected to the arc
	 */
	public Node getStartNode(){
		return this.startNode;
	}
	
	/**
	 * Sets the end node connected to the arc.
	 * @param endNode
	 */
	public void setEndNode(Node endNode){
		this.endNode = endNode;
	}
	
	/**
	 * Returns the end node connected to the arc.
	 * @return the end node connected to the arc
	 */
	public Node getEndNode(){
		return this.endNode;
	}
	
}
